﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace RATSharp.Model
{
    /// <summary>
    /// Model for reservation.
    /// </summary>
    public class Reservation
    {
        /// <summary>
        /// Reservation id
        /// </summary>
        public int? id { get; set; }
        /// <summary>
        /// object id for reservation
        /// </summary>
        public int objectId { get; set; }
        /// <summary>
        /// object name for Reservation
        /// </summary>
        public string objectName { get; set; }
        /// <summary>
        /// Reservations periods collection
        /// </summary>
        public Periods periods { get; set; }
        /// <summary>
        /// Reservations owner user id
        /// </summary>
        public int userId { get; set; }
        /// <summary>
        /// Reservation owner name
        /// </summary>
        public string userName { get; set; }

        /// <summary>
        /// Default constructor
        /// </summary>
        public Reservation()
        {
            //prevents NPX
            periods = new Periods();
        }

        /// <summary>
        /// overriden for properties visibility
        /// </summary>
        /// <returns>string representation</returns>
        public override string ToString()
        {
            return String.Format("Id: {0}, ObjectName: {1}, Owner: {2}, NumberOfPeriods: {3} ", id, objectName, userName, periods.Count);
        }
    }
}
